package com.yhd.singleton;

import lombok.Data;

/**
 * @author yhd
 * @email yinhuidong1@xiaomi.com
 * @description TODO
 * @since 2021/5/22 下午4:31
 */
@Data
public class MeiZi {

    private String name;

    private Integer age;
    //懒汉，饿汉  指令重排序
    private static volatile MeiZi meiZi ;

    private MeiZi(){

    }

    public static MeiZi getInstance(){
        if (meiZi==null){
            synchronized (MeiZi.class){
                if (meiZi==null){
                    return new MeiZi();
                }
            }
        }
        return meiZi;
    }
}
